package com.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class AspectXML {
    //定义前置通知
    public void myBefore(JoinPoint joinPoint) {
        System.out.println("*****myBefore***前置通知");
        System.out.println("aop 目标类==" + joinPoint.getTarget());
        System.out.println("织入方法" + joinPoint.getSignature().getName());
    }

    public void myAfterReturning(JoinPoint joinPoint) {
        System.out.println("*****myAfterReturning***后置返回通知");
        System.out.println("织入方法" + joinPoint.getSignature().getName());
    }

    public Object myAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("环绕通知开始****");
        Object obj = proceedingJoinPoint.proceed();
        System.out.println("环绕通知结束****");
        return obj;
    }

    public void myAfter(JoinPoint joinPoint) {
        System.out.println("*****mmyAfter***后置通知");
        System.out.println("织入方法" + joinPoint.getSignature().getName());
    }

    public void myException(JoinPoint joinPoint,Throwable e) {
        System.out.println("*****myException***异常通知,出错信息:" + e.getMessage());
    }

}
